﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DynaPrecision.DataFitting
{
	internal class L2NormGeneratedMatrix<Tx, Ty> : LinearSystem.IMultiDimensionalArray<Ty>
	{
		public List<Func<Tx, Ty>> FunctionList = new List<Func<Tx, Ty>>();
		public List<Tx> Xs
		{
			get
			{
				return _innerproduct.InputList;
			}
		}

		InnerProductSpace.DiscretizedL2InnerProduct<Tx, Ty> _innerproduct = new InnerProductSpace.DiscretizedL2InnerProduct<Tx, Ty> { InputList = new List<Tx>() };

		#region IMultiDimensionalArray<Ty> Members

		public Ty this[params int[] index]
		{
			get
			{
				return _innerproduct.InnerProduct(FunctionList[index[0]], FunctionList[index[1]]);
			}
			set
			{
				throw new NotImplementedException();
			}
		}

		public int GetLength(int DimensinNumber)
		{
			if (DimensinNumber < Dimension)
			{
				return FunctionList.Count;
			}
			else
			{
				return 0;
			}
		}

		public int Dimension
		{
			get { return 2; }
		}

		#endregion
	}
}
